package com.next

class Address
{
    String address 
    // 收货地址

    String fullName
    // 联系人姓名

    String firstName

    String lastName

    String cellphone
    // 联系电话

    String zip
    // 邮编

    String city
    String email

    Boolean active = false


    Date createdDate = new Date()
    Date modifiedDate = new Date()

    static belongsTo = [contact: Contact]

    static constraints = {

        address maxSize: 256
        zip maxSize: 16, nullable: true, blank: true
        fullName nullable: true, blank: true
        cellphone nullable: true, blank: true

        contact nullable: true, blank: true
        city nullable: true, blank: true
        email nullable: true, blank: true
        
        firstName nullable: true, blank: true
        lastName nullable: true, blank: true

        createdDate nullable: true, blank: true
        modifiedDate nullable: true, blank: true
    }

    def beforeUpdate()
    {
        modifiedDate = new Date()
    }

    String toString()
    {
        address
    }
}
